You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ERROR de.fraunhofer.iem.podmanager.rabbitmq.Consumer - Field 'PkgID' is required for type with serial name 'de.fraunhofer.iem.spha.model.adapter.trivy.TrivyVulnerabilityDto', but it was missing at path: $.Results[0].Vulnerabilities[1]
This happened because the output of the Trivy scan contains Python packages without any PkgID, for example:
{
"Target": "Python",
"Class": "lang-pkgs",
"Type": "python-pkg",
"Vulnerabilities": [
{
"VulnerabilityID": "CVE-2024-22190",
"PkgName": "GitPython",
"PkgPath": "home/redacted/.local/lib/python3.11/site-packages/GitPython-3.1.37.dist-info/METADATA",
"PkgIdentifier": {
"PURL": "pkg:pypi/[email protected]",
"UID": "5591a0dc57c78b2"
},
"InstalledVersion": "3.1.37",
"FixedVersion": "3.1.41",
"Status": "fixed",
"Layer": {
"Digest": "sha256:13b0acb9b68e8a74b8e6152932c5bd6c6968e13fa32feba83cc2310346a9b7f9",
"DiffID": "sha256:feea6321b4864eb2cb16188d1619323db7c8738adaca6982c8005da9fe227961"
},
"SeveritySource": "ghsa",
"PrimaryURL": "https://avd.aquasec.com/nvd/cve-2024-22190",
"DataSource": {
"ID": "ghsa",
"Name": "GitHub Security Advisory pip",
"URL": "https://github.com/advisories?query=type%3Areviewed+ecosystem%3Apip"
},
"Title": "Untrusted search path under some conditions on Windows allows arbitrary code execution",
"Description": "GitPython is a python library used to interact with Git repositories. There is an incomplete fix for CVE-2023-40590. On Windows, GitPython uses an untrusted search path if it uses a shell to run `git`, as well as when it runs `bash.exe` to interpret hooks. If either of those features are used on Windows, a malicious `git.exe` or `bash.exe` may be run from an untrusted repository. This issue has been patched in version 3.1.41.",
"Severity": "HIGH",
"CweIDs": [
"CWE-426"
],
"VendorSeverity": {
"ghsa": 3,
"nvd": 3
},
"CVSS": {
"ghsa": {
"V3Vector": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
"V3Score": 7.8
},
"nvd": {
"V3Vector": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
"V3Score": 7.8
}
},
"References": [
"https://github.com/gitpython-developers/GitPython"
],
"PublishedDate": "2024-01-11T02:15:48.25Z",
"LastModifiedDate": "2024-01-18T13:48:07.553Z"
}
]
}
Changes
This PR changes the Trivy Vulnerability Dto to get PkgName and InstalledVersion instead of PkgID, because these fields are always available regardless of scan target types. Tests are updated with this PR too.
hutomosaleh
changed the title
fix: use PkgIdentifier and PURL to support non-OS targets
fix: use PkgName and InstalledVersion to support non-OS targets
Oct 30, 2024
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When running a trivy scan for https://gitlab.opencode.de/opencode-analyzer/occmd-public, I receive the following error:
This happened because the output of the Trivy scan contains Python packages without any
PkgID
, for example:Changes
This PR changes the Trivy Vulnerability Dto to get
PkgName
andInstalledVersion
instead ofPkgID
, because these fields are always available regardless of scan target types. Tests are updated with this PR too.